package com.sunda.spmsweb.wmscontroller;


import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sunda.spmscommon.ResponseResult;
import com.sunda.spmsweb.util.JWTUtil;
import com.sunda.spmswms.entity.ShelfOnTask;
import com.sunda.spmswms.entity.ShelfOnTaskDtl;
import com.sunda.spmswms.service.ISapDeliveryNoteLogService;
import com.sunda.spmswms.service.IWhsOutService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 出库任务表 前端控制器
 * </p>
 *
 * @author Wayne
 * @since 2021-04-23
 */
@RestController
@RequestMapping("/whsOut")
@Api(tags = "出库任务表接口", description = "出库任务表接口")
public class WhsOutController {

    @Autowired
    IWhsOutService iWhsOutService;

    @Autowired
    ISapDeliveryNoteLogService iSapDeliveryNoteLogService;

    @RequestMapping("/getWhsOutList")
    @ApiOperation(value = "获取出库任务表头", notes = "获取出库任务表头信息\n" +
            "werks, whsLocationCode 参数实例如下所示，必须要有值才会有返回结果；其余字段可选；\n" +
            "taskStatus 可传值多个，逗号分隔。传空则默认查所有状态。\n" +
            "20210617变更：获取信息中新增 EMPTY_CABINET_WEIGHT 空柜重量（KG）字段，前端输入；弃用 LOADING_TYPE 装柜方式字段；\n" +
            "{\n" +
            "\t\"werks\": [\"CN01\"],\n" +
            "\t\"whsLocationCode\": [\"1011\", \"1061\"],\n" +
            "\t\"whsOutNo\": \"\",\n" +
            "\t\"packageList\": \"\",\n" +
            "\t\"goodsType\": \"\",\n" +
            "\t\"dateOfLoading\": \"\",\n" +
            "\t\"cabinetSerialNumber\": \"\",\n" +
            "\t\"taskStatus\": \"0,1\",\n" +
            "\t\"pageNo\": 1,\n" +
            "\t\"pageSize\": 20\n" +
            "}", httpMethod = "POST")
    public ResponseResult createWhsStorage(@RequestBody JSONObject doc) {
        //IPage<WhsOut> whsOutList = iWhsOutService.getWhsOutList(doc);
        Page<Map<String, Object>> whsOutList = iWhsOutService.getWhsOutListPage(doc);
        if (whsOutList != null) {
            return ResponseResult.success().add("whsOutList", whsOutList);
        }
        return ResponseResult.error();
    }

    @RequestMapping("/getWhsOutDtl")
    @ApiOperation(value = "获取出库任务明细", notes = "获取出库任务明细\n" +
            "goodsType 货物类型； uuid 出库任务uuid；参数实例如下所示，必须要有值才会有返回结果；\n" +
            "goodsType = M; uuid = 3f71d2e3dd1546b0aa1f337313ac4cf6; \n" +
            "goodsType = X; uuid = 23444500c18c4f898950ac5de825bb01 或 a4d00f4ad1ee4043955e24e421c55988\n" +
            "同时返回出库任务关联日志信息\n" +
            "20210617变更：贸易货出库任务明细获取时，新增 ACTUAL_PACKING_NUMBER 实际装箱件数（销售单位），根据物料基本信息中的换算关系计算得出，必输；" +
            "CUSTOMS_DECLARATION_NUMBER 报关件数；PACKING_SPEC 包装规格；LOADING_TYPE 装柜方式；\n" +
            "备件货新增字段 装箱件数字段暂未由前端输入；报关件数无此字段；PACKING_SPEC 包装规格；LOADING_TYPE 装柜方式；\n",
            httpMethod = "POST")
    public ResponseResult getWhsOutDtl(String goodsType, String uuid) {
        List<Map<String, Object>> whsOutDtl = iWhsOutService.getWhsOutDtl(goodsType, uuid);
        if (whsOutDtl != null) {
            return ResponseResult.success()
                    .add("whsOutDtl", whsOutDtl)
                    .add("whsOutLog", iSapDeliveryNoteLogService.getDocumentLogs(uuid))
                    .add("whsOut",iWhsOutService.getWhsOutByUuid(uuid));
        }
        return ResponseResult.error();
    }

    @RequestMapping("/getWhsOutDtlX")
    @ApiOperation(value = "获取出库任务明细-备件货-带下架任务", notes = "获取出库任务明细-备件货-带下架任务\n" +
            "goodsType 货物类型； uuid 出库任务uuid；参数实例如下所示，必须要有值才会有返回结果；\n" +
            "goodsType = X; 只接受 备件货goodsType = X;  uuid = 23444500c18c4f898950ac5de825bb01 或 a4d00f4ad1ee4043955e24e421c55988\n" +
            "taskType = 2 下架任务-2 \n" +
            "同时返回出库任务明细，关联下架任务明细，关联日志信息",
            httpMethod = "POST")
    public ResponseResult getWhsOutDtlX(String uuid) {
        ResponseResult whsOutDtl = iWhsOutService.getWhsOutDtlX(uuid);

        if (whsOutDtl.getCode() != 200) {
            return whsOutDtl;
        }
        return whsOutDtl.add("whsOutLog", iSapDeliveryNoteLogService.getDocumentLogs(uuid));
    }

    @RequestMapping("/getBoxNoteDtl")
    @ApiOperation(value = "获取备件出库任务箱码明细(备件货)", notes = "获取备件出库任务箱码明细\n" +
            "boxNote = TEST-1008-0101",
            httpMethod = "POST")
    public ResponseResult getBoxNoteDtl(String boxNote) {
        List<Map<String, Object>> boxNoteDtl = iWhsOutService.getBoxNoteDtl(boxNote);
        if (boxNoteDtl != null) {
            return ResponseResult.success().add("boxNoteDtl", boxNoteDtl);
        }
        return ResponseResult.error();
    }

    @RequestMapping("/initShelfOnTask")
    @ApiOperation(value = "出库任务初始化下架任务(备件货)", notes = "出库任务初始化下架任务\n" +
            "createDate = 20210509, uuid = a4d00f4ad1ee4043955e24e421c55988",
            httpMethod = "POST")
    public ResponseResult initShelfOnTask(String createDate, String uuid) {
        int resp = iWhsOutService.initShelfOnTask(JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString()), createDate, uuid);
        if (resp == -1) {
            return ResponseResult.error("出库任务不存在或已下发下架任务");
        }
        ShelfOnTask shelfOnTask = iWhsOutService.getShelfOnTaskByRelateDocNumber(uuid, "2");
        List<ShelfOnTaskDtl> shelfOnTaskDtl = new ArrayList<>();
        if (shelfOnTask != null){
            shelfOnTaskDtl = iWhsOutService.getShelfOnTaskDtlByRelateDocNumber(shelfOnTask.getUuid());
        }
        return ResponseResult.success().add("shelfOnTask", shelfOnTask).add("shelfOnTaskDtl", shelfOnTaskDtl);
    }

    @RequestMapping("/updateWhsOut")
    @ApiOperation(value = "完成出库任务(备件货)", notes = "出库任务执行完成\n" +
            "1.检查出库任务状态，只有状态 1执行中 才能完成，其他状态返回错误信息；\n" +
            "2.检查所有待操作的箱子和数量，在仓库储位库存、仓库库存是否都存在；不存在则返回错误信息；\n" +
            "3.更新下架任务明细，直接删除已有明细建立新的下架任务明细；前端传输下架明细时包括下架任务所有明细行；\n" +
            "4.更新储位库存表，扣减下架明细中的箱码库存；\n" +
            "5.记录储位库存台账；\n" +
            "6.更新下架任务表头状态为 已完成；\n" +
            "7.记录下架任务操作日志记录；\n" +
            "8.更新出库任务明细表（装箱单明细表），更新出库任务明细行数据状态为 2已完成；对于少出的箱子，忽略更新，实出箱数字段为空忽略；\n" +
            "9.对于多出的箱子，根据多出标记将 装箱单号、箱号、实出箱数 新增写入 装箱单箱码关系表中；同时新增 装箱单明细 表的行数；\n" +
            "10.记录出库任务更新（新增多出行数）日志；\n" +
            "11.更新仓库库存，扣减出库明细中的箱码库存；\n" +
            "12.记录仓库库存台账；\n" +
            "13.更新出库任务表头状态为 出库完成；\n" +
            "14.记录出库任务完成日志；\n" +
            "15.已下架但未出库的差异项，重新生成一个待执行的上架任务，上架明细由前端传入；\n" +
            "16.记录新建上架任务的日志信息；\n" +
            "部分字段说明：whsOutDtl 中的 unplanned 字段，前台传值默认为空，表示是原出库任务中的明细；操作员增加了计划之外的出库明细，则需标记 unplanned = 1。\n" +
            "pdaSn 必传；submitDate 前台传值当前日期带横线；actualLoadingDate 实际装柜日期；monitorLoading 监装人员；" +
            "loadingType 装柜方式；cabinetCheckResult 货柜检验结果；remarks 备注；\n" +
            "\n" +
            "20210618更新：表头装柜方式字段弃用；备件货出库明细中新增两个字段 \n" +
            "   包装规格 PACKING_SPEC；\n" +
            "   装柜方式 LOADING_TYPE；都在 whsOutDtl 行上，按行录入数据；\n" +
            "示例数据，下架三箱出库两箱，剩余一项重新上架：\n" +
            "{\n" +
            "\t\"pdaSn\": \"1234567890\",\n" +
            "\t\"submitDate\": \"2021-05-12\",\n" +
            "\t\"shelfOnTask\": {\n" +
            "\t\t\"uuid\": \"3e74fd02509f4e0b900c6c5433bc19b7\",\n" +
            "\t\t\"currentStatus\": \"7\",\n" +
            "\t\t\"targetStatus\": \"3\",\n" +
            "\t\t\"relateDocNumber\": \"23444500c18c4f898950ac5de825bb01\"\n" +
            "\t},\n" +
            "\t\"shelfOnTaskDtls\": [{\n" +
            "\t\t\"uuid\": \"3e74fd02509f4e0b900c6c5433bc19b7\",\n" +
            "\t\t\"taskRowId\": 10,\n" +
            "\t\t\"boxNote\": \"TEST-1009-0101\",\n" +
            "\t\t\"actualOperateQty\": \"1\",\n" +
            "\t\t\"targetStorage\": \"b95946ac1dab42b79ade3438acb0b513\",\n" +
            "\t\t\"unplanned\": \"\"\n" +
            "\t}, {\n" +
            "\t\t\"uuid\": \"3e74fd02509f4e0b900c6c5433bc19b7\",\n" +
            "\t\t\"taskRowId\": 20,\n" +
            "\t\t\"boxNote\": \"TEST-1009-0102\",\n" +
            "\t\t\"actualOperateQty\": \"1\",\n" +
            "\t\t\"targetStorage\": \"b95946ac1dab42b79ade3438acb0b513\",\n" +
            "\t\t\"unplanned\": \"\"\n" +
            "\t}, {\n" +
            "\t\t\"uuid\": \"3e74fd02509f4e0b900c6c5433bc19b7\",\n" +
            "\t\t\"taskRowId\": 30,\n" +
            "\t\t\"boxNote\": \"TEST-1003-0101\",\n" +
            "\t\t\"actualOperateQty\": \"1\",\n" +
            "\t\t\"targetStorage\": \"b95946ac1dab42b79ade3438acb0b512\",\n" +
            "\t\t\"unplanned\": \"\"\n" +
            "\t}],\n" +
            "\t\"whsOut\": {\n" +
            "\t\t\"uuid\": \"23444500c18c4f898950ac5de825bb01\",\n" +
            "\t\t\"werks\": \"CN01\",\n" +
            "\t\t\"whsLocationCode\": \"1011\",\n" +
            "\t\t\"cabinetNumber\": \"JZX20217788\",\n" +
            "\t\t\"currentStatus\": 1,\n" +
            "\t\t\"operateUser\": \"operate user name\",\n" +
            "\t\t\"targetStatus\": 2,\n" +
            "\t\t\"actualLoadingDate\": \"2021-05-12\",\n" +
            "\t\t\"monitorLoading\": \"zhang san\",\n" +
            "\t\t\"loadingType\": \"A\",\n" +
            "\t\t\"remarks\": \"remarks\",\n" +
            "\t\t\"cabinetCheckResult\": \"ok\",\n" +
            "\t\t\"leadSeal\": \"123456789\"\n" +
            "\t},\n" +
            "\t\"whsOutDtl\": [{\n" +
            "\t\t\"packageList\": \"PL1001\",\n" +
            "\t\t\"boxNote\": \"TEST-1009-0101\",\n" +
            "\t\t\"actualOperateQty\": 1,\n" +
            "\t\t\"unplanned\": \"\",\n" +
            "\t\t\"containerBrand\": \"123\",\n" +
            "\t\t\"packingSpec\": \"123\",\n" +
            "\t\t\"loadingType\": \"123\"\n" +
            "\t}, {\n" +
            "\t\t\"packageList\": \"PL1001\",\n" +
            "\t\t\"boxNote\": \"TEST-1009-0102\",\n" +
            "\t\t\"actualOperateQty\": \"\",\n" +
            "\t\t\"unplanned\": \"\",\n" +
            "\t\t\"containerBrand\": \"123\",\n" +
            "\t\t\"packingSpec\": \"123\",\n" +
            "\t\t\"loadingType\": \"123\"\n" +
            "\t}],\n" +
            "\t\"remainingBoxNote\": [{\n" +
            "\t\t\"boxNote\": \"TEST-1003-0101\",\n" +
            "\t\t\"quantity\": 1\n" +
            "\t}]\n" +
            "}",
            httpMethod = "POST")
    public ResponseResult updateWhsOut(@RequestBody JSONObject jsonObject) {
        String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
        return iWhsOutService.updateWhsOut(jsonObject, userId);
    }

    @RequestMapping("/updateWhsOutM")
    @ApiOperation(value = "完成出库任务(贸易货)", notes = "贸易货完成出库任务，补单形式\n" +
            "贸易货出库任务完成，补单形式.\n" +
            "1.先判断 whsOut.targetStatus 值，1表示保存功能，不做库存检查；2表示提交功能，需检查各物料库存；\n" +
            "2.每次保存或提交前，现根据 出库任务uuid 和 unplanned = 1 删除已有的计划外行数；" +
            "3.对于出库明细中 unplanned = '1' 的项在装箱单明细中新增行；计划外的行，item 字段传空值；\n" +
            "4.用户提交结果，则更新出库任务表头；记录操作日志；\n" +
            "5.更新出库任务明细/装箱单明细，更新实际出库数量(基本单位)字段；有新增行则新增关联数据；记录操作日志；\n" +
            "6.扣减出库贸易货的储位库存，记录储位出库台账；\n" +
            "20210618更新：贸易货出库数据更新时，按行新增四个字段。表头装柜方式字段弃用；\n" +
            "   ACTUAL_PACKING_NUMBER 实际装箱件数（销售单位），必输；后端暂未做必输控制；\n" +
            "   CUSTOMS_DECLARATION_NUMBER 报关件数，贸易货默认取实际装箱件数，可编辑；\n" +
            "   PACKING_SPEC 包装规格；\n" +
            "   LOADING_TYPE 装柜方式；\n" +
            "{\n" +
            "\t\"whsOut\": {\n" +
            "\t\t\"uuid\": \"17e02ac85c8d491b8889e14d0f453057\",\n" +
            "\t\t\"werks\": \"CN01\",\n" +
            "\t\t\"whsLocationCode\": \"1011\",\n" +
            "\t\t\"cabinetNumber\": \"JZX20217788\",\n" +
            "\t\t\"currentStatus\": 0,\n" +
            "\t\t\"targetStatus\": 2,\n" +
            "\t\t\"operateUser\": \"operate user name\",\n" +
            "\t\t\"actualLoadingDate\": \"2021-05-12\",\n" +
            "\t\t\"monitorLoading\": \"zhang san\",\n" +
            "\t\t\"loadingType\": \"A\",\n" +
            "\t\t\"remarks\": \"remarks\",\n" +
            "\t\t\"cabinetCheckResult\": \"ok\",\n" +
            "\t\t\"leadSeal\": \"123456789\"\n" +
            "\t},\n" +
            "\t\"whsOutDtl\": [{\n" +
            "\t\t\"packageList\": \"PL1001\",\n" +
            "\t\t\"item\": \"10\",\n" +
            "\t\t\"materialNo\": \"210026516\",\n" +
            "\t\t\"actualOperateQty\": 10,\n" +
            "\t\t\"containerBrand\": \"11\",\n" +
            "\t\t\"colorNumber\": \"12\",\n" +
            "\t\t\"thickness\": \"13\",\n" +
            "\t\t\"actualAvgGrossWeight\": \"14\",\n" +
            "\t\t\"actualPackingNumber\": 10,\n" +
            "\t\t\"customsDeclarationNumber\": 10,\n" +
            "\t\t\"packingSpec\": \"123\",\n" +
            "\t\t\"loadingType\": \"123\",\n" +
            "\t\t\"storageUuidList\": [{\n" +
            "\t\t\t\"storageUuid\": \"b95946ac1dab42b79ade3438acb0b511\",\n" +
            "\t\t\t\"qty\": 10\n" +
            "\t\t}],\n" +
            "\t\t\"unplanned\": \"\"\n" +
            "\t}, {\n" +
            "\t\t\"packageList\": \"PL1001\",\n" +
            "\t\t\"item\": \"\",\n" +
            "\t\t\"materialNo\": \"210026515\",\n" +
            "\t\t\"actualOperateQty\": \"10\",\n" +
            "\t\t\"containerBrand\": \"11\",\n" +
            "\t\t\"colorNumber\": \"12\",\n" +
            "\t\t\"thickness\": \"13\",\n" +
            "\t\t\"actualAvgGrossWeight\": \"14\",\n" +
            "\t\t\"actualPackingNumber\": 10,\n" +
            "\t\t\"customsDeclarationNumber\": 10,\n" +
            "\t\t\"packingSpec\": \"123\",\n" +
            "\t\t\"loadingType\": \"123\",\n" +
            "\t\t\"storageUuidList\": [{\n" +
            "\t\t\t\"storageUuid\": \"b95946ac1dab42b79ade3438acb0b511\",\n" +
            "\t\t\t\"qty\": 10\n" +
            "\t\t}],\n" +
            "\t\t\"unplanned\": \"1\"\n" +
            "\t}]\n" +
            "}\n",
            httpMethod = "POST")
    public ResponseResult updateWhsOutM(@RequestBody JSONObject jsonObject) {
        String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
        return iWhsOutService.updateWhsOutM(jsonObject, userId);
    }

    @RequestMapping("/whsOutToSap")
    @ApiOperation(value = "出库任务结果提交SAP", notes = "出库任务结果提交SAP\n" +
            "只有出库完成单据才能提交SAP，状态一定是从 2 -> 4；示例数据：备件货出库任务 uuid = 23444500c18c4f898950ac5de825bb01；\n" +
            "贸易货出库任务uuid = 997958077fd040c9a551e0ae43112538 或 ae1f3604ceac4608a3981629899f9e72；\n" +
            "confirmLastSubmission 用户决定是否为最后一次提交SAP，1是，0否；默认0否；———— 前端不再传此值，后端自行决定；后端会根据出库任务" +
            "uuid查找当前出库任务同装箱单的  所有未成功提交SAP  的任务数量，不为 1 则当前不是最后一次提交SAP；提交SAP成功 TASK_STATUS = 4；",
            httpMethod = "POST")
    public ResponseResult getWhsOutToSap(@RequestParam String uuid) {
        String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
        return iWhsOutService.getWhsOutToSap(uuid, userId);
    }

    @RequestMapping("/getWhsOutLog")
    @ApiOperation(value = "获取出库任务关联日志", notes = "获取出库任务关联日志\n" +
            "获取出库任务关联日志，入参 uuid 为出库任务 uuid",
            httpMethod = "POST")
    public ResponseResult getWhsOutLog(String uuid) {
        return ResponseResult.success().add("whsOutLog", iSapDeliveryNoteLogService.getDocumentLogs(uuid));
    }

    @RequestMapping("/saveWhsOutX")
    @ApiOperation(value = "保存备件出库过程(仅供Web端)", notes = "保存备件出库过程(仅供Web端)\n" +
            "请求参数参考 updateWhsOut-完成出库任务(备件货) 参数。\n" +
            "备件货出库任务详情保存:\n" +
            "  1.检验出库任务表头当前状态、目标状态状态是否可更新；\n" +
            "  2.删除下架任务详情，重新建下架任务详情；表头不更新；记录下架任务操作日志；\n" +
            "  3.出库任务详情——SAP_PACKAGE_BOX 删除计划外行数，更新计划内行数据；\n" +
            "  4.更新出库任务表头状态及其他字段，记录表头更新操作日志；\n" +
            "20210618变更：表头装柜方式字段弃用；箱码新增信息 包装规格 PACKING_SPEC；装柜方式 LOADING_TYPE；都在行项目；",
            httpMethod = "POST")
    public ResponseResult saveWhsOutX(@RequestBody JSONObject doc) {
        String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
        return iWhsOutService.saveWhsOutX(doc, userId);
    }

    @RequestMapping("/getWhsOutDtlList")
    @ApiOperation(value = "获取多个出库任务详情打印", notes = "获取多个出库任务详情打印\n" +
            "packageList = PL1002，cabinetSerialNumber = 01，werks = CN01，whsLocationCode = 1061" +
            "cabinetSerialNumber 可选，其余三个字段必输且每次只输入一个。",
            httpMethod = "POST")
    public ResponseResult getWhsOutDtlList(String packageList, String cabinetSerialNumber, String werks, String whsLocationCode) {
        return iWhsOutService.getWhsOutDtlList(packageList, cabinetSerialNumber, werks, whsLocationCode);
    }

    @RequestMapping("/withdrawWhsOutM")
    @ApiOperation(value = "贸易货出库撤销", notes = "贸易货出库撤销\n" +
            "whsOutUuid:出库任务的uuid \n" +
            "currentStatus:出库任务的当前状态 \n",
            httpMethod = "POST")
    public ResponseResult withdrawWhsOutM(String whsOutUuid, String currentStatus) {
        String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
        return iWhsOutService.withdrawWhsOutM(whsOutUuid,currentStatus,userId);
    }

    @RequestMapping("/withdrawWhsOutX")
    @ApiOperation(value = "备件货出库撤销", notes = "备件货出库撤销\n" +
            "whsOutUuid:出库任务的uuid \n" +
            "currentStatus:出库任务的当前状态 \n",
            httpMethod = "POST")
    public ResponseResult withdrawWhsOutX(String whsOutUuid, String currentStatus) {
        String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
        return iWhsOutService.withDrawWhsOutX(whsOutUuid,currentStatus,userId);
    }

//    @RequestMapping("/whsOutCancel")
//    @ApiOperation(value = "出库任务从SAP撤销", notes = "出库任务从SAP撤销\n" +
//            "packageList: PL00027402 \n" +
//            "whsOutUuid: 2247b44f8b414f5f8ceb13c36cfd302c \n",
//            httpMethod = "POST")
//    public ResponseResult whsOutCancel(String packageList, String whsOutUuid) {
//        String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
//        return iWhsOutService.whsOutCancel(packageList, whsOutUuid, userId);
//    }

    @RequestMapping("/whsOutClose")
    @ApiOperation(value = "出库任务关闭", notes = "出库任务关闭\n" +
            "whsOutUuid:出库任务的uuid，示例 251a4760f484467788eb00973b73c235 \n" +
            "remarks:出库任务关闭备注 \n",
            httpMethod = "POST")
    public ResponseResult whsOutClose(String whsOutUuid, String remarks) {
        String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
        return iWhsOutService.whsOutClose(whsOutUuid, userId, remarks);
    }

}
